#!/usr/bin/perl

# load modules
require "./electric_bulletin_board-lib.pl";
require "./config.pl";


# show header
&ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);

# create temp directory
$temporary_path = &transname();
mkdir("$temporary_path");

# read argument in %in
&ReadParse();

# display step tabs start
@tabs = (["status", $text{'index_tab_status'}, "index.cgi?tab=status"],
         ["create", $text{'index_tab_create'}, "index.cgi?tab=create"],
         ["delete", $text{'index_tab_delete'}, "index.cgi?tab=delete"],
         ["pattern", $text{'index_tab_pattern'}, "index.cgi?tab=pattern"],
         ["setting", $text{'index_tab_setting'}, "index.cgi?tab=setting"],
         ["systeminfo", $text{'index_tab_systeminfo'}, "index.cgi?tab=systeminfo"],
        );
print &ui_tabs_start(\@tabs, "tabs", $in{'tab'} || "status", 0);

# status tab
require "./status-tab.pl";
print &ui_tabs_start_tab("tabs", "status");
print &status_run();
print &status_tab();
print &ui_tabs_end_tab();

# create tab
require "./create-tab.pl";
print &ui_tabs_start_tab("tabs", "create");
print &create_run();
print &create_tab();
print &ui_tabs_end_tab();

# delete tab
require "./delete-tab.pl";
print &ui_tabs_start_tab("tabs", "delete");
print &delete_run();
print &delete_tab();
print &ui_tabs_end_tab();

# pattern tab
require "./pattern-tab.pl";
print &ui_tabs_start_tab("tabs", "pattern");
print &pattern_run();
print &pattern_tab();
print &ui_tabs_end_tab();

# setting tab
require "./setting-tab.pl";
print &ui_tabs_start_tab("tabs", "setting");
print &setting_run();
print &setting_tab();
print &ui_tabs_end_tab();

# systeminfo tab
require "./systeminfo-tab.pl";
print &ui_tabs_start_tab("tabs", "systeminfo");
print &systeminfo_run();
print &systeminfo_tab();
print &ui_tabs_end_tab();

# show step tabs end
print &ui_tabs_end(0);


print "<hr>\n";
print "--- Debug Code --------------------------", "<br>\n";
print "argument<br>";
print &show_hash(\%in);
print "<br>\n";
print "config<br>";
print &show_hash(\%config);
print "<br>\n";
print "module_info<br>";
print &show_hash(\%module_info);
print "--- Debug Code --------------------------", "<br>\n";

# show footer
&ui_print_footer("/", $text{'index'});

